home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 1996 September / Software of the Month Club 1996 September.iso / mac / Software Research Institute-SRI / Business / Alpha ƒ / Tcl / SystemCode / paths.tcl < prev    next >
Encoding:
Text File  |  1996-01-03  |  2.7 KB  |  90 lines  |  [TEXT/ALFA]

  1.  
  2. # Any directory must have 'folder' somewhere in the comment.
  3. set pathComments(texPath)        "TeX application"
  4. set pathComments(TeXInputs)        "TeX Inputs folder"
  5. set pathComments(bibtexPath)    "BibTeX"
  6. set pathComments(cdPath)        "CodeWarrior Debugger"
  7. set pathSig(cdPath)                "cwdSig"
  8. set pathComments(cwPath)        "CodeWarrior Compiler"
  9. set pathSig(cwPath)                "cwSig"
  10. set pathComments(mailPath)        "Eudora Path"
  11. set pathComments(excaliburPath)    "Excalibur Spellchecker"
  12. set pathComments(macperlPath)    "MacPerl"
  13. set pathComments(perlFilterPath)     "MacPerl Text Filters folder"
  14. set pathComments(perlDocs)         "MacPerl documentation folder"
  15. set pathComments(perlLib)         "MacPerl lib folder"
  16. set pathComments(referencePath)    "Think Reference"
  17. set pathComments(tassPath)        "Toolbox Assistant"
  18. set pathComments(kodexPath)        "Kodex C Pretty Printer"
  19. set pathComments(enscriptorPath) "Enscriptor Fancy Printer"
  20. set pathComments(droppsPath)    "DropÑPS"
  21. set pathComments(symPath)        "Symantec Project Manager"
  22. set pathComments(symDbgPath)    "Symantec Debugger"
  23.  
  24.  
  25. set tmp {}
  26. foreach n [array names pathComments] {
  27.     lappend tmp $pathComments($n)
  28. }
  29. menu -n appPaths -m -p pathProc [lsort $tmp]
  30. unset tmp
  31.  
  32.  
  33. #===============================================================================
  34.  
  35. proc pathProc {menu comment} {
  36.     global pathComments modifiedVars pathSig pathUseIC
  37.  
  38.     foreach path [array names pathComments] {
  39.         if {$pathComments($path) == $comment} {
  40.             global $path                
  41.             if {[info exists $path]} {
  42.                 set buttons {OK Change Remove Launch}
  43.             } else {
  44.                 set buttons {OK Set Remove}
  45.             }
  46.             if {[info exists pathUseIC($path)]} {
  47.                 lappend buttons "IConfig"
  48.             }
  49.             
  50.             set res [eval [list buttonAlert "$pathComments($path):\r[set $path]"] $buttons]
  51.  
  52.             switch $res {
  53.                 "Set"        "-"
  54.                 "Change"     {     if {[regexp -nocase {.*folder.*} $pathComments($path)]} {
  55.                                     set $path [get_directory -p "Select $pathComments($path):"]
  56.                                 } else {
  57.                                     set $path [getfile "Select $pathComments($path):"]
  58.                                 }
  59.                 
  60.                                 lappend modifiedVars $path
  61.                                 if {[info exists pathSig($path)]} {
  62.                                     global $pathSig($path)
  63.                                     set $pathSig($path) [getFileSig [set $path]]
  64.                                     lappend modifiedVars $pathSig($path)
  65.                                 }
  66.                 }
  67.                 "Remove"    { set $path {} }
  68.                 "Launch"    { launch -f  [set $path] }
  69.                 "IConfig" {
  70.                     if {[askyesno "Set '$path' from 'Internet Config'?"] == "yes"} {
  71.                         if {[catch {icGetPref -t 1 $pathUseIC($path)} npath]} {
  72.                             alertnote "Internet Config Error (installed?)"
  73.                         } else {
  74.                             message $npath
  75.                             set $path $npath
  76.                             lappend modifiedVars $path
  77.                             if {[info exists pathSig($path)]} {
  78.                                 global $pathSig($path)
  79.                                 set $pathSig($path) [getFileSig [set $path]]
  80.                                 lappend modifiedVars $pathSig($path)
  81.                             }
  82.                         }
  83.                     }
  84.                 }
  85.             }
  86.             return
  87.         }
  88.     }
  89. }
  90.